<?php
namespace app\admin\controller;
use app\admin\logic\AccountLogLogic;

class AccountLogController extends Controller
{
    /**
     * note 资金记录
     */
    public function capital_list(){
        if($this->request->isAjax()){
            $get = $this->request->get();
            $list = AccountLogLogic::lists($get);
            return json([
                'code' =>1,
                'msg'  =>'',
                'data' =>$list
            ]);
        }
        $this->assign('order_source',AccountLogLogic::orderSourceList(1));
        return $this->fetch();
    }
    /**
     * note 积分记录
     */
    public function integral_list(){
        if($this->request->isAjax()){
            $get = $this->request->get();
            $list = AccountLogLogic::lists($get);
            return json([
                'code' =>1,
                'msg'  =>'',
                'data' =>$list
            ]);
        }
        $this->assign('order_source',AccountLogLogic::orderSourceList(2));
        return $this->fetch();
    }
    /**
     * Notes: 佣金记录
     * @return mixed
     */
    public function withdraw_list()
    {
        if($this->request->isAjax()){
            $get = $this->request->get();
            $list = [];
            switch ($get['type']) {
                case 'distribution':
                    $list = AccountLogLogic::getDistributionLog($get);
                    break;
            }
            return json([
                'code' =>1,
                'msg'  =>'',
                'data' =>$list
            ]);
        }
        return $this->fetch();
    }


    /**
     * Notes: 佣金统计
     */
    public function withdrawTotalCount()
    {
        if ($this->request->isAjax()) {
            $get = $this->request->get();
            $result = AccountLogLogic::withdrawTotalCount($get);
            return json([
                'code' =>1,
                'msg'  =>'',
                'data' =>$result
            ]);
        }
    }

}